package com.example.hotelmanager.ui.activity;

import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;

import com.example.hotelmanager.AppStackManager;
import com.example.hotelmanager.R;
import com.example.hotelmanager.widget.LeftMenuFragment;
import com.slidingmenu.lib.app.SlidingFragmentActivity;

public class BaseActivity extends SlidingFragmentActivity {

    protected LeftMenuFragment mLeftMenuFragment;
    
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		// 添加Activity到堆栈
		AppStackManager.getAppManager().addActivity(this);
		setBehindContentView(R.layout.menu_frame);
        FragmentTransaction t = this.getSupportFragmentManager().beginTransaction();
        mLeftMenuFragment = new LeftMenuFragment();
        t.replace(R.id.menu_frame, mLeftMenuFragment);
        t.commit();
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		// 结束Activity&从堆栈中移除
		AppStackManager.getAppManager().finishActivity(this);
	}
	
}
